import http from "@/utils/request";
import { getMenuTree } from "./site";
import * as product from "./product";
// export const login = ({ username, password }) => {
//   return http.post("/token-auth/", { username, password });
// };
// 登陆
export const login = ({ username, password }) =>
  http.post("/token-auth/", { username, password });
// login({username: 123, password: 123}).then(res => res.data).catch(err);
// async ()=> { let res = await login({username: 123, password: 123})}
// 注册   登出  获取。。。信息   修改。。。。信息
// 登出
export const logout = () => http.get("/logout");
//注册

// 获取当前正在登陆的用户信息
export const user = () => http.get("/user/");
// 修改个人信息
// userinfo 后期用户传入的数据  必须包含id  可能包含{username  nickname  phone  email}
export const edituser = (userinfo) =>
  http.put(`/user/${userinfo.id}/`, userinfo);

export default {
  getMenuTree,
  login,
  logout,
  user,
  edituser,
  product, // 将命名导入的内容导出
};
